<?php include '../public/header.php' ?>
<?php include '../public/header_index.php' ?>
<body class="laytp-container">
<div id="opt_nav">
</div>

<div class="layui-card" id="search-form">
    <div class="layui-card-body">
        <form class="layui-form" id="TableSearchFormId" lay-filter="TableSearchForm" onkeydown="keyTableSearch('TableSearchForm', 'datalist')">
            <div class="layui-form-item">
                <div class="layui-row">
                    <div class="layui-col-md3">
                        <label class="layui-form-label">流程单号</label>
                        <div class="layui-input-block">
                            <input type="text" name="sericnum" placeholder="请输入" class="layui-input" autocomplete="off">
                        </div>
                    </div>
                    <div class="layui-col-md3">
                        <label class="layui-form-label">审核状态：</label>
                        <div class="layui-input-block">
                            <select id="status" name="status" lay-filter="status">
                                <option value="">请选择</option>
                                <option value="1">流程（审批通过）</option>
                                <option value="0">流程（审批中）</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-col-md3">
                        <label class="layui-form-label">项目名称</label>
                        <div class="layui-input-block">
                            <input type="text" name="enginname" placeholder="请输入" class="layui-input" autocomplete="off">
                        </div>
                    </div>
                    <div class="layui-col-md3 search_hide none">
                        <label class="layui-form-label">预算编号</label>
                        <div class="layui-input-block">
                            <input type="text" name="number" placeholder="请输入" class="layui-input" autocomplete="off">
                        </div>
                    </div>
                    <div class="layui-col-md3 search_hide none">
                        <label class="layui-form-label">名称及规格</label>
                        <div class="layui-input-block">
                            <input type="text" name="listname" placeholder="请输入" class="layui-input" autocomplete="off">
                        </div>
                    </div>
                    <div class="layui-col-md3 search_hide none">
                        <label class="layui-form-label">预算分类：</label>
                        <div class="layui-input-block">
                            <select id="budtype" name="budtype" lay-filter="budtype">
                                <option value="">请选择</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-col-md3">
                        <div class="layui-form-item search-div">
                            <div class="layui-form-item layui-inline">
                                <button class="laytp-btn laytp-btn-md laytp-btn-primary" id="TableSearchButton" type="button"><i class="layui-icon layui-icon-search"></i>查询</button>
                                <button class="layui-btn layui-btn-primary" onclick="listTableReset()" id="TableSearchReset" type="reset" ><i class="layui-icon layui-icon-refresh"></i>重置</button>
                                <div id="search_open" onclick="toggle_search()">
                                    <i class="layui-icon layui-icon-down"></i>展开
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </form>
    </div>
</div>

<div class="layui-card" id="table-card">
    <div class="layui-card-body">
        <div class="layui-row">
            <div class="layui-col-md12" id="table_list">
                <div class="layui-card-body">
                    <table id="datalist" lay-filter="datalist"></table>
                </div>
            </div>
        </div>
    </div>
</div>

<script type="text/html" id="test-dropdown-toolbar-barDemo">
    <div class="tab-list-authbut">
        <a href="javascript:;" class="bar_opt" onclick="auth_but_func_show('查看','{{d.LAY_TABLE_INDEX}}')">查看</a>
    </div>
</script>
<script type="text/html" id="toolbarDemo">
    <div class = "layui-btn-container">
<!--        <button class="layui-btn layui-btn-primary outbut" onclick="auth_but_func_fan('返款登记')">返款登记</button>-->
    </div>
</script>
<script>

    var param_enginid = getQueryVariable('enginid') || 0;
    var param_listid = getQueryVariable('listid') || 0;
    var param_status = getQueryVariable('status') || '';



    layui.use(["laytp",'laypage','table','dropdown','form','soulTable'], function () {
        var laypage = layui.laypage, table = layui.table, dropdown = layui.dropdown, form = layui.form, soulTable = layui.soulTable;


        $('#TableSearchReset').click(function () {
            $('.xmselect_div>xm-select').find('.xm-label-block').css('display','none');
            $('.xmselect_div').append('<div class="xmselect_title">请选择</div>');
            searchTableFunc(form, table)
        });

        setSouTableExport('预算编制明细');
        var mytable = table.render({
            elem: "#datalist",id: "datalist"
            ,url: facade.url(ask_engin_budget_detail),where: {enginid:param_enginid, status:param_status,listid:param_listid}, page: true, height: 'full-140'
            ,soulSort: TabInit.soulSort,method: TabInit.method, toolbar: TabInit.toolbar, overflow: TabInit.overflow
            ,defaultToolbar: TabInit.defaultToolbar,filter: TabInit.filter
            ,request: TabInit.request,response: TabInit.response,contextmenu:get_table_contextmenu(soulTable)
            ,text: TabInit.text,totalRow: true
            ,parseData: function (res) {

                xiala_zhan_one_zuo('budtype', res.data.budtype, res.data.is_budtype);

                render_from();
                return {
                    "code": res.code,
                    "msg": res.message,
                    "count": res.data.data.total,
                    "data": res.data.data.data
                };
            }
            , cols: [[
                {type: "checkbox", fixed: 'left'}
                ,{type:'numbers',title:'序号',totalRowText: '合计',fixed:'left'}
                ,{field:'sericnum',title:'流程单号',templet: function(d){
                        return '<span class="colorlan" onclick="openPage(\'../engin_budget/show.php?id='+d.id+'\');">'+d.sericnum+'</span>';
                    }}
                ,list_bill_cols_str
                ,{field:'name',title:'项目名称',templet: function(d){
                    return '<span class="colorlan" onclick="openPage(\'../engin/show.php?id='+d.enginid+'\')">'+d.enginname+'</span>';
                }}
                ,{field:'number',title:'预算编号',templet: function(d){
                        return '<span class="colorlan" onclick="openPage(\'../engin_budget/show.php?id='+d.id+'\')">'+d.number+'</span>';
                    }}
                ,{field: 'budtype_name', title: '预算分类'}
                ,{field: 'listname', title: '名称及规格'}
                ,{field: 'listunit', title: '单位'}
                ,{field: 'listnum', title: '预算数量',totalRow: true,align:'right'}
                ,{field: 'listprice', title: '预算单价(元)',totalRow: true,align:'right',templet: function(d){return parseFormatNum(d.listprice);}}
                ,{field: 'listmoney', title: '预算金额(元)',totalRow: true,align:'right',templet: function(d){return parseFormatNum(d.listmoney);}}
                ,{field: 'listexplain', title: '预算说明'}
                ,{field: 'yiqiannum', title: '已签合同数量',totalRow: true,align:'right'}
                ,{field: 'yiqianmoney', title: '已签合同金额(元)',totalRow: true,align:'right',templet: function(d){return parseFormatNum(d.yiqianmoney);}}
                ,{field: 'yiqianjun', title: '已签合同均价(元)',totalRow: true,align:'right',templet: function(d){return parseFormatNum(d.yiqianjun);}}
                ,{field: 'shengnum', title: '预算剩余数量(元)',totalRow: true,align:'right',templet: function(d){
                        if(d.shengnum < 0){
                            return '<span class="colorhong">'+d.shengnum+'</span>';
                        }
                        return d.shengnum;
                    }}
                ,{field: 'shengmoney', title: '预算剩余金额(元)',totalRow: true,align:'right',templet: function(d){
                    if(d.shengmoney < 0){
                        return '<span class="colorhong">'+parseFormatNum(d.shengmoney)+'</span>';
                    }
                    return parseFormatNum(d.shengmoney);
                }}
                ,{field: 'engin_chanid_name', title: '项目所属单位'}
            ]]
            , done: function (res) {
                soulTable.render(this);
            }
        });


        listTableSearch(form, table);
    });





</script>
</body>
</html>
